package com.mihuo.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.mihuo.entity.vo.ConfigVO;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mihuo.entity.SysConfig;
import com.mihuo.mapper.SysConfigMapper;
import com.mihuo.service.ISysConfigService;
@Service
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements ISysConfigService{

    @Override
    @Cacheable(value = "appConfigs",key = "1") //缓存配置
    public Map<String, String> getAppConfigs() {
        return lambdaQuery().eq(SysConfig::getIsPublic,1).list().stream().collect(Collectors.toMap(SysConfig::getConfigKey,SysConfig::getConfigValue));
    }
}
